import type { UnwrapNestedRefs } from 'vue'

export interface FormState {
  roleId: number | string
  roleName: string
  roleCode: string
  statusFlag: number
  remark: string
  roleSort: number
}

export function getRoleInfoApi(current: number | string, pageSize: number | string) {
  return useGet<FormState>('/role/list', { 'current': current, 'pageSize': pageSize })
}

export function roleSaveApi(formState: UnwrapNestedRefs<FormState> & {}) {
  return usePost<number>('/role/save', formState)
}

export function roleUpdateApi(formState: UnwrapNestedRefs<FormState> & {}) {
  return usePost<number>('/role/update', formState)
}

export function roleDeleteApi(id: number | string) {
  return usePost<string>('/role/delete', { 'id': id })
}
